Valve modules and methods for producing the generic type are known from the prior art. Thus, for example, valve modules from brake systems of motor vehicles are known, which, in a non-actuated state, cause brake fluid to pass through, in order to build up pressure in the brake system, and which, in an actuated state, close the flow cross section after the pressure build-up has taken place, in order to hold the pressure. Solenoid valves, in particular, have proved to be highly suitable in this case. Known valves have an essentially cylindrical valve basic body, in which a valve needle is axially displaceable, for example under magnetic control. The valve basic body is closed at one end by a housing cap which forms a capsule around the basic body and which is secured to the latter by means of a holding device. As is known, the holding device is formed as a weld seam which extends over the entire circumference and which connects the housing cap and the valve body inseparably to one another, as a result of which, on the one hand, the leaktightness of the valve can be ensured and, on the other hand, high forces generated when the valve is in operation can be absorbed.